home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / gcc / ixemul-4.lha / ixemul-41.4 / man / cat2 / getlogin.0 < prev    next >
Text File  |  1992-08-10  |  3KB  |  67 lines

  1.  
  2. GETLOGIN(2)                UNIX Programmer's Manual                GETLOGIN(2)
  3.  
  4. NNAAMMEE
  5.      ggeettllooggiinn, sseettllooggiinn - get/set login name
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<uunniissttdd..hh>>
  9.  
  10.      _c_h_a_r _*
  11.      ggeettllooggiinn(_v_o_i_d)
  12.  
  13.      _i_n_t
  14.      sseettllooggiinn(_c_o_n_s_t _c_h_a_r _*_n_a_m_e)
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      The ggeettllooggiinn() routine returns the login name of the user associated with
  18.      the current session, as previously set by sseettllooggiinn().  The name is nor­
  19.      mally associated with a login shell at the time a session is created, and
  20.      is inherited by all processes descended from the login shell.  (This is
  21.      true even if some of those processes assume another user ID, for example
  22.      when su(1) is used.)
  23.  
  24.      SSeettllooggiinn() sets the login name of the user associated with the current
  25.      session to _n_a_m_e. This call is restricted to the super­user, and is nor­
  26.      mally used only when a new session is being created on behalf of the
  27.      named user (for example, at login time, or when a remote shell is in­
  28.      voked).
  29.  
  30. RREETTUURRNN VVAALLUUEESS
  31.      If a call to ggeettllooggiinn() succeeds, it returns a pointer to a null­
  32.      terminated string in a static buffer.  If the name has not been set, it
  33.      returns NULL. If a call to sseettllooggiinn() succeeds, a value of 0 is returned.
  34.      If sseettllooggiinn() fails, a value of ­1 is returned and an error code is
  35.      placed in the global location _e_r_r_n_o.
  36.  
  37. EERRRROORRSS
  38.      The following errors may be returned by these calls:
  39.  
  40.      [EFAULT]      The _n_a_m_e parameter gave an invalid address.
  41.  
  42.      [EINVAL]      The _n_a_m_e parameter pointed to a string that was too long.
  43.                    Login names are limited to MAXLOGNAME (from <_s_y_s_/_p_a_r_a_m_._h>)
  44.                    characters, currently 12.
  45.  
  46.      [EPERM]       The caller tried to set the login name and was not the su­
  47.                    per­user.
  48.  
  49. SSEEEE AALLSSOO
  50.      setsid(2)
  51.  
  52. BBUUGGSS
  53.      Login names are limited in length by sseettllooggiinn().  However, lower limits
  54.      are placed on login names elsewhere in the system (UT_NAMESIZE in
  55.      <_u_t_m_p_._h>).
  56.  
  57.      In earlier versions of the system, ggeettllooggiinn() failed unless the process
  58.      was associated with a login terminal.  The current implementation (using
  59.      sseettllooggiinn()) allows getlogin to succeed even when the process has no con­
  60.      trolling terminal.  In earlier versions of the system, the value returned
  61.      by ggeettllooggiinn() could not be trusted without checking the user ID.
  62.      Portable programs should probably still make this check.
  63.  
  64. HHIISSTTOORRYY
  65.      The ggeettllooggiinn function call is currently under development.
  66.  
  67.